st = []
ope = ["(", "{", "[", "<"]
a = input("Please enter the bracket sequence: ")
for i in a:
    if i in ope:
        #  print(i, "open")
        st.append(i)
    else:
        if len(st) == 0:
            pass
        # print("False")
        else:
            #  print(i, st[-1], st)
            if i == ')' and st[-1] == '(':
                del st[-1]
            elif i == '}' and st[-1] == '{':
                del st[-1]
            elif i == ']' and st[-1] == '[':
                del st[-1]
            elif i == '>' and st[-1] == '<':
                del st[-1]
            else:
                pass
        # print("False")
if len(st) == 0:
    print("True")
else:
    print("False")